/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.sockets.exemplos2;

import java.io.IOException;
import java.io.PrintStream;
import java.net.Socket;
import java.util.Scanner;

/**
 *
 * @author andersonribeiro
 */
public class Cliente {

    private static int porta = 12345;
    private static String IP = "127.0.0.1";

    public static void main(String[] args) throws IOException {

        Socket cliente = new Socket(IP, porta);
        System.out.println("O cliente se conectou ao servidor!");

        Scanner teclado = new Scanner(System.in);
        PrintStream saida = new PrintStream(cliente.getOutputStream());

        while (teclado.hasNextLine()) {
            saida.println(teclado.nextLine());
            /*if (teclado.toString().trim().equals("fim")) {
                System.exit(0);    
            }*/
        }

        saida.close();
        teclado.close();
        cliente.close();

    }
}
